.TH std::basic_stacktrace::rbegin,std::basic_stacktrace::crbegin 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::basic_stacktrace::rbegin,std::basic_stacktrace::crbegin \- std::basic_stacktrace::rbegin,std::basic_stacktrace::crbegin

.SH Synopsis
   const_reverse_iterator rbegin()  const noexcept; \fB(1)\fP (since C++23)
   const_reverse_iterator crbegin() const noexcept; \fB(2)\fP (since C++23)

   Returns a reverse iterator to the first entry of the reversed basic_stacktrace. It
   corresponds to the last entry of the original basic_stacktrace. If the
   basic_stacktrace is empty, the returned iterator is equal to rend().

   range-rbegin-rend.svg

.SH Parameters

   \fI(none)\fP

.SH Return value

   Reverse iterator to the first entry.

.SH Complexity

   Constant.

.SH Example


// Run this code

 #include <algorithm>
 #include <iostream>
 #include <stacktrace>

 int main()
 {
     auto trace       = std::stacktrace::current();
     auto empty_trace = std::stacktrace{};

     // Print stacktrace.
     std::for_each(trace.rbegin(), trace.rend(),
                   [](const auto& f) { std::cout << f << '\\n'; });

     if (empty_trace.rbegin() == empty_trace.rend())
         std::cout << "stacktrace 'empty_trace' is indeed empty.\\n";
 }

.SH Possible output:

 0x0000000000402A29 in ./prog.exe
 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
 0x0000000000402BA5 in ./prog.exe
 stacktrace 'empty_trace' is indeed empty.

.SH See also

   rend  returns a reverse iterator to the end
   crend \fI(public member function)\fP
